<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .test {
            color:#f00;
        }
    </style>
</head>
<body>
    <h2 class="title">React演示--jsx</h2>
    <div id="root"></div>
    
</body>
<script src="./lib/react.js"></script>
<script src="./lib/react-dom.js"></script>
<script src="./lib/babel.min.js"></script>
<script type="text/babel">
    //获取dom
    const box=document.querySelector('#root')
    //创建一个react根元素
    const root=ReactDOM.createRoot(box)
  
     class App extends React.Component {
        constructor() {
            super()
            //类似于vue的data
            this.state={
                num:666
            }
        }

        render() {
            return <div>我是一个app根组件---{ this.state.num }</div>
        }
     }


    //渲染
    root.render(<App />)


</script>
</html>